let arr = [3, 48, 66, 71, 99, 101, 120, 151, 188, 209];

function searching(arr, target) {
  let mid;
  let start = 0;
  let end = arr.length - 1;

  let element;

  while (start <= end) {
    mid = Math.floor((start + end) / 2);
    element = arr[mid];
    if (element == target) {
      return mid;
    }
    else if (element < target) {
      start = mid + 1;
    }
    else {
      end = mid - 1;
    }
  }
  return -1;
}

console.log(searching(arr, 71));